package com.mattidroid.spiegel;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

/** Implement onClickListener to dismiss dialog when OK Button is pressed */
public class DialogClass extends Dialog implements OnClickListener {
	
	Button okButton;
	
	public DialogClass(Context context) {
		super(context);
		
		/** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
		// requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		setContentView(R.layout.about_dialog);

		setTitle(
				this.getContext().getString(R.string.AppIdentifier) + 
				" " 
				+ this.getContext().getString(R.string.about_title)
		);

		TextView text = (TextView) findViewById(R.id.text);
		text.setText(this.getContext().getString(R.string.about_info));

		ImageView image = (ImageView) findViewById(R.id.image);
		image.setImageResource(R.drawable.androidmarker);
		
		okButton = (Button) findViewById(R.id.button_ok);
		okButton.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		if (v == okButton)
			dismiss();
	}

}
